const variables = this.pageObj.getVariables();
const table = this.pageObj.getApiWidgetByAliasName('选择系统表格')?.widgetObj

const sysEnvType = variables.find(v => v.name === 'sysEnvType')?.value || '';
const userId = variables.find(v => v.name === 'userId')?.value || '';
const prefix = variables.find(v => v.name === 'environmentType')?.value || '';

const basics = BasicServices.getInstance(prefix)
const portalYX = RequestFetch.portalYX(prefix)
const requestGW = new RequestFetch('http://192.168.1.221:8089')

basics.
if (sysEnvType === "gt") {

    portalYX.get('/portal/sso-api/api/user/queryById', { userId }).then((res) => {
        if (res?.userInfo?.roleInfos) {
            let data = res.userInfo.roleInfos.map(item => {
                return {
                    ...item,
                    careerName: item.roleName,
                    careerCode: item.roleId,
                }
            });

            table.setData([{ data }]);
            table.render();
        }
    })
} else {
    requestGW.get("/admin/role/getRoleListByUserId", { userId }).then(({ code, data } = {}) => {
        if (code === 200 && Array.isArray(data)) {
            table.setData([{
                data: data.map(item => ({ ...item, careerName: item.roleName, careerCode: item.roleCode }))
            }]);
            table.render();
        }
    })
}
